<?php
error_reporting(0);
require("smtp.php");

$server = $_COOKIE['server'];//设置SMTP服务器
$serverport = $_COOKIE['serverport'];//SMTP服务器端口，默认为25
$usermail = $_COOKIE['usermail'];//SMTP服务器的用户邮箱
$user = $_COOKIE['euser'];//SMTP服务器的用户帐号
$pass = $_COOKIE['epass'];//SMTP服务器的用户密码
$mtype = "HTML";//邮件格式（HTML/TXT）,TXT为文本邮件
$titles = $_GET['titles'];
$texts = $_GET['texts'];
$estart = $_GET['start'];

$smtpserver = $server;
$smtpserverport = $serverport;
$smtpusermail = $usermail;
$smtpuser = $user;
$smtppass = $pass;
$mailtype = $mtype;
$mailsubject = $titles;
$mailbody = $texts;
$eadd = $estart+1;
$start = $estart."@qq.com";
$smtpemailto = "$start";
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
$smtp->debug = false;
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>智能邮件群发系统[QQ邮件版]丨港子工坊</title>
		<link rel="shortcut icon" href="favicon.ico" />
		<link rel="stylesheet" href="style/css/bootstrap.min.css" />
		<link rel="stylesheet" href="style/css/style.css" />
	</head>
	<body>
		<div align="center">
			<div class="top">
				<p>
					<a href="index.php">智能邮件群发系统</a>
				</p>
			</div>
			
			<div class="send">
				<p>
					<?php 
						if($_COOKIE['server']!=""&&$_COOKIE['serverport']!=""&&$_COOKIE['usermail']!=""&&$_COOKIE['euser']!=""&&$_COOKIE['epass']!=""){
							if ($estart>="10000") {
								echo "<center>正在向邮箱 $start 发送邮件。<br />请稍候........</center>";
								header("refresh:4;url=?start=$eadd");
							} else {
								echo "<script>alert('信息有误，请重新填写信息后发送！');window.location.href='index.php';</script>";
							}
						}else{
							echo "<script>alert('尚未配置邮件服务器，请配置完成后再进行群发！');window.location.href='index.php';</script>";
						}
					?>
				</p>
			</div>
			
			<div class="footer">
				<p>
					版权所有 &copy; <a href="http://www.wg1997.cn" target="_blank">港子工坊</a>
				</p>
			</div>
		</div>
	</body>
</html>
